import request from '../../util/request.js';

export const fetchData = (query) => {
    return request({
        url: '/ms/table/list',
        method: 'post',
        data: query
    })
}
//账户管理获取数据
export const countManger = (query) => {
    return request({
        url: '/user/getUsers/'+query.pageNum+'/'+query.pageSize,
        method: 'get',
        data: query
    })
}

//账户管理新增
export const addCountManger = (query) => {
    return request({
        url: '/user/addUser',
        method: 'post',
        data: query
    })
}
//账户管理修改
export const editCountManger = (query) => {
    return request({
        url: '/user/updateUser',
        method: 'post',
        data: query
    })
}
//账户管理删除
export const delCountManger = (query) => {
    return request({
        url: '/user/deleteUser',
        method: 'post',
        data: query
    })
}
//角色管理，获取模块及子模块菜单
export const getModelMenu = (query) => {
    return request({
        url: '/function/getFuctionList',
        method: 'get',
        data: query
    })
}

//角色管理，新增角色
export const addRole = (query) => {
    return request({
        url: '/role/addRoles',
        method: 'post',
        data: query
    })
}

//角色管理，获取角色列表
export const getRoleList = (query) => {
    return request({
        url: '/role/getRoles/'+query.pageNum+'/'+query.pageSize,
        method: 'get',
        data: query
    })
}

//角色管理，获取角色已选中的模块列表
export const getCheckedRoleList = (query) => {
    return request({
        url: '/role/getRoleFunction',
        method: 'post',
        data: query
    })
}

//角色管理编辑修改角色
export const editRole = (query) => {
    return request({
        url: '/role/updateRole',
        method: 'post',
        data: query
    })
}
//获取加密的公钥
export const getPublicKey = (query)=>{
    return request({
        url:'/user/getPublicEncrptKey',
        method:'get',
        data:query
    })
}
//登录
export const userlogin = (query) => {
    return request({
        url: '/user/login',
        method: 'post',
        data: query
    })
}

//组织机构管理导航
export  const regionalRoot =(query) => {
    return request({
        url:'/org/getRoot',
        method:'get',
        data:query
    })
}
//组织机构新增
export const regionalAdd =(query) => {
    return request({
        url:'/org/addOrg',
        method:'post',
        data:query
    })
}

//组织机构列表
//组织机构获取子节点
export  const getSubOrgList =(query) => {
    return request({
        url:'/org/getSubOrgList/'+query.pid,
        method:'get',
        data:query
    })
}

//获取字典分项
export const getDictionData =(query) => {
    return request({
        url:'/dic/getDictionCategoryItem',
        method:'get',
        data:query
    })
}
//获取分项的列表
export const getDictionList =(query) => {
    return request({
        url:'/dic/getDicCategorySubItems/'+query.pid ,
        method:'get',
        data:query
    })
}
//新增分项的列表
export const addDiction =(query) => {
    return request({
        url:'/dic/addSystemDictionary',
        method:'post',
        data:query
    })
}

//修改分项接口
export const  dicEdit =(query) =>{
    return request({
        url:'/dic/updateSystemDictionary',
        method:'post',
        data:query
    })
}

//组织机构修改
export const editOrg =(query) =>{
    return request({
        url:'/org/updateOrg',
        method:'post',
        data:query
    })
}
//组织机构删除
export const deleteOrg =(query) =>{
    return request({
        url:'/org/deleteOrg/'+query.subId,
        method:'get',
        data:query
    })
}

//获取建筑扩展信息
export const getBuildInfo =(query) =>{
    return request({
        url:'/dic/getDictionValue',
        method:'post',
        data:query
    })
}

//新增扩展信息
export const addOrgExtendInfo =(query) =>{
    return request({
        url:'/org/addOrgExtendInfo',
        method:'post',
        data:query
    })
}

//新增改造信息
export const addOrgBuildingRenoInfo =(query) =>{
    return request({
        url:'/org/addOrgBuildingRenoInfo',
        method:'post',
        data:query
    })
}

//获取改造信息
export const getOrgRenoInfo =(query) =>{
    return request({
        url:'/org/getOrgRenoInfo/'+query.buildId,
        method:'get',
        data:query
    })
}

//获取扩展信息想去
export const getOrgExtendInfo =(query) =>{
    return request({
        url:'/org/getOrgExtendInfo/'+query.buildId,
        method:'get',
        data:query
    })
}

//修改扩展信息之前获取扩展信息

export const getOrgExtendInfoBeforeUpdate =(query) =>{
    return request({
        url:'/org/getOrgExtendInfoBeforeUpdate/'+query.buildId,
        method:'get',
        data:query
    })
}

//修改扩展信息
export const updateExtendInfo =(query) =>{
    return request({
        url:'/org/updateExtendInfo',
        method:'post',
        data:query
    })
}

//删除改造信息
export const deleteBuildingRenoInfoByIds =(query) =>{
    return request({
        url:'/org/deleteBuildingRenoInfoByIds',
        method:'post',
        data:query
    })
}
//设备管理设备类型下拉内容接口
export  const  getDeviceTypeList =(query) =>{
    return request({
        url:'/device/getDeviceTypeList',
        method:'get',
        data:query
    })
}
//设备管理模糊查询数据接口
export const searchAll =(query) =>{
    return request({
        url: '/device/queryDeviceListByOrgId/'+query.pageNum+'/'+query.pageSize,
        method:'post',
        data:query
    })
}
//设备管理新增
export const addDevice =(query) =>{
    return request({
        url:'/device/addDevice',
        method:'post',
        data:query
    })
}

//获取设备类型
export const getDeviceType = (query) => {
    return request({
        url: '/device/getDeviceTypeList',
        method: 'get',
        data: query
    })
}

//设备类型新增
export const addDeviceType =(query) =>{
    return request({
        url:'/device/addDeviceType',
        method:'post',
        data:query
    })
}


//设备类型修改
export const updateDeviceType =(query) =>{
    return request({
        url:'/device/updateDeviceType',
        method:'post',
        data:query
    })
}

//修改设备类型获取信息
export const getDeviceTypeInfo =(query) =>{
    return request({
        url:'/device/getDeviceType/'+query.typeId,
        method:'get',
        data:query
    })
}

//设备类型控制功能删除
export const deleteFunctionOfDeviceType =(query) =>{
    return request({
        url:'/device/deleteFunctionListById/'+query.id,
        method:'get',
        data:query
    })
}

//设备类型数据配置删除
export const deleteDataListByDeviceTypeId =(query) =>{
    return request({
        url:'/device/deleteDataListById/'+query.id,
        method:'get',
        data:query
    })
}

//设备类型状态参数删除
export const deleteStateListByDeviceTypeId =(query) =>{
    return request({
        url:'/device/deleteStateListById/'+query.id,
        method:'get',
        data:query
    })
}

//设备类型删除
export const deleteDeviceType =(query) =>{
    return request({
        url:'/device/deleteDeviceType/'+query.id,
        method:'get',
        data:query
    })
}
    //网关分页接口
export const getAdministrationPage =(query) =>{
    return request({
        url:'/device/getDataCollectorList/'+query.pageNum+'/'+query.pageSize,
        method:'get',
        data:query
    })
}
//设备管理获取网关下拉数据
export const getAllCollector =(query) =>{
    return request({
        url:'/device/getDataCollectorListAll',
        method:'get',
        data:query
    })
}
//获取设备管理能源来源and能耗类型and网关协议
//获取网关管理通讯协议 and 网关协议
export  const getCategory =(query) =>{
    return request({
        url:'/dic/getDictionaryItemByCategory',
        method:'post',
        data:query
    })
}
//获取设备管理设备组
export  const getGroupList =(query) =>{
    return request({
        url:'/device/getDeviceGroupList',
        method:'get',
        data:query
    })
}


//获取所有网关列表
export const getDataCollectorListAll =(query) =>{
    return request({
        url:'/device/getDataCollectorListAll',
        method:'get',
        data:query
    })
}

//获取设备组列表
export const getDeviceGroupList =(query) =>{
    return request({
        url:'/device/getDeviceGroupList',
        method:'get',
        data:query
    })
}

//获取设备组列表
export const getDeviceGroupExtendInfo =(query) =>{
    return request({
        url:'/device/getDeviceGroupExtendInfo',
        method:'get',
        data:query
    })
}

//新增设备组
export const addDeviceGroup =(query) =>{
    return request({
        url:'/device/addDeviceGroup',
        method:'post',
        data:query
    })
}
//删除设备组
export const delDeviceGroup =(query) =>{
    return request({
        url:'/device/delDeviceGroup/'+query.id,
        method:'get',
        data:query
    })
}

//修改设备组
export const updateDeviceGroup =(query) =>{
    return request({
        url:'/device/updateDeviceGroup',
        method:'post',
        data:query
    })
}

//获取设备组设备列表
export const getSelectGroupList =(query) =>{
    return request({
        url: '/device/queryDeviceGroupInfo/'+query.pageNum+'/'+query.pageSize,
        method:'post',
        data:query
    })
}



//设备组划分设备
export const batchAllocateDeviceToDeviceGroup =(query) =>{
    return request({
        url: '/device/batchAllocateDeviceToDeviceGroup/'+query.id,
        method:'post',
        data:query
    })
}

//设备组已划分设备移除
export const batchRemoveDeviceFromDeviceGroup =(query) =>{
    return request({
        url: '/device/batchRemoveDeviceFromDeviceGroup',
        method:'post',
        data:query
    })
}
//网关管理新增接口
export const addDataCollector =(query) =>{
    return request({
        url:'/device/addDataCollector',
        method:'post',
        data:query
    })
}
//网关管理修改接口
export  const  updateDataCollector =(query) =>{
    return request({
        url:'/device/updateDataCollector',
        method:'post',
        data:query
    })
}
//网关管理删除接口
export const batchDeleteDataCollectors = (query) => {
    return request({
        url: '/device/batchDeleteDataCollectors',
        method: 'post',
        data: query
    })
}
//中继器新增device/addRepeaterLink
export const addRepeaterLink =(query) =>{
    return request({
        url:'/device/addRepeaterLink',
        method:'post',
        data:query
    })
}
//中继器管理获取列表
export const getRepeaterLinkList =(query) =>{
    return request({
        url:'/device/getRepeaterLinkList',
        method:'get',
        data:query
    })
}
//中继器管理修改接口updateRepeater
export  const  updateRepeater =(query) =>{
    return request({
        url:'/device/updateRepeater',
        method:'post',
        data:query
    })
}
//中继器管理删除接口deleteRepeater/{id}
export  const  deleteRepeater =(query) =>{
    return request({
        url:'/device/deleteRepeater/'+query.id,
        method:'get',
        data:query
    })
}

//添加策略接口
export const addStrategy =(query) =>{
    return request({
        url:'/strategy/addStrategy',
        method:'post',
        data:query
    })
}


//获取策略接口
export const getTimerStrategy =(query) =>{
    return request({
        url:'/strategy/getTimerStrategy',
        method:'get',
        data:query
    })
}
// 修改策略接口
export const updateTimerStrategy =(query) =>{
    return request({
        url:'/strategy/updateTimerStrategy',
        method:'post',
        data:query
    })
}
// 删除策略的单个动作接口
export const deleteStrategyAction =(query) =>{
    return request({
        url:'/strategy/deleteStrategyAction/'+query.id,
        method:'get',
        data:query
    })
}
//设备管理高级查询/device/dynamicSerachDeviceInfo/{pageNo}/{pageSize}
export const dynamicSerachDeviceInfo =(query) => {
    return request({
        url: '/device/dynamicSerachDeviceInfo/' + query.pageNum + '/' + query.pageSize,
        method: 'post',
        data: query
    })
}
//设备管理删除接口/device/deleteDevice/{id}
export const deleteDevice =(query) =>{
    return request({
        url:'/device/deleteDevice/'+query.id,
        method:'get',
        data:query
    })
}
//设备管理修改接口 and 启用 and 禁用 /device/updateDevice
export const updateDevice =(query) =>{
    return request({
        url:'/device/updateDevice',
        method:'post',
        data:query
    })
}


// 绑定设备组和策略
export const allocateStrategyToGroup =(query) =>{
    return request({
        url:'/strategy/allocateStrategyToGroup/'+query.strategyId+'/'+query.groupId,
        method:'get',
        data:query
    })
}

// 获取设备组的策略列表
export const getStrategyForGroup =(query) =>{
    return request({
        url:'/strategy/getStrategyForGroup/'+query.groupId,
        method:'get',
        data:query
    })
}

// 获取设备组的策略列表
export const getDeviceMonitorList =(query) =>{
    return request({
        url:'/device/getDeviceMonitorList/' + query.pageNum + '/' + query.pageSize,
        method:'post',
        data:query
    })
}

// 设置网关的中继器链接
export const setDataCollectorRepeaterInfo =(query) =>{
    return request({
        url:'/device/setDataCollectorRepeaterInfo/' + query.cId + '/' + query.rId,
        method:'get',
        data:query
    })
}
//系统日志
export const  getSystemLog =(query) =>{
    return request({
        url:'/system/getSysLog/'+query.pageNum + '/' +query.pageSize,
        method:'post',
        data:query
    })
}
//新增中继链路
// /batchSetRepeaterForDevices/{repeaterId}
export const batchDevices =(query) =>{
    return request({
        url:'/device/batchSetRepeaterForDevices/' + query.repeaterId,
        method:'post',
        data:query
    })
}

//获取编辑地图的未添加列表数据
export const getListUnaddGis =(query) =>{
    return request({
        url:'/device/getListsForDeviceUnallocateToGis/'+query.gisType,
        method:'get',
        data:query
    })
}
//获取编辑地图的已添加列表数据
export const getListAddedGis =(query) =>{
    return request({
        url:'/device/getDeviceGisInfoList/'+query.gisType,
        method:'get',
        data:query
    })
}
//编辑地图添加标注点
export const addPointGis =(query) =>{
    return request({
        url:'/device/addDeviceOrOrgToGisMap',
        method:'post',
        data:query
    })
}

//编辑地图移动标注点
export const movePointGis =(query) =>{
    return request({
        url:'/device/updateDeviceOrOrgInGisMap',
        method:'post',
        data:query
    })
}
//编辑地图删除标注点
export const deletePointGis =(query) =>{
    return request({
        url:'/device/removeDeviceOrOrgFromGisMap',
        method:'post',
        data:query
    })
}
//gis地图获取设备信息
export const getDeviceDetailInfo =(query) =>{
    return request({
        url:'/device/getDeviceOrBuildOperateInfo',
        method:'post',
        data:query
    })
}

//能耗汇总接口
export const getCalTotalEnergy =(query) =>{
    return request({
        url:'/energy/calTotalEnergy/'+query.typeName,
        method:'get',
        data:query
    })
}

//获取能耗类型接口
export const getEnergyTypeData =(query) =>{
    return request({
        url:'/energy/getBaseEnergyTypeList',
        method:'get',
        data:query
    })
}

//获取组织类型接口
export const getOrgTypeData =(query) =>{
    return request({
        url:'/energy/getBaseOrgTypeList',
        method:'get',
        data:query
    })
}

//获取统计对象接口
export const getOrgObjData =(query) =>{
    return request({
        url:'/energy/getEnergyOrgList/'+query.typeName,
        method:'get',
        data:query
    })
}

//建筑能耗分析点击搜索
export const getAllBuildListData =(query) =>{
    return request({
        url:'/energy/queryOrgEnergyConsumption',
        method:'post',
        data:query
    })
}

//建筑能耗报表点击搜索
export const getAllBuildListFormData =(query) =>{
    return request({
        url:'/energy/queryBuildEnergyCounsumptionReport',
        method:'post',
        data:query
    })
}

//设备能统计根据设备获取数据项
export const getDeviceAndData =(query) =>{
    return request({
        url:'/device/getDeviceDataConfigListByDeviceId/'+query.deviceId,
        method:'get',
        data:query
    })
}
//设备能统计根据能源类型获取设备数据
export const getDeviceAndEnergyType =(query) =>{
    return request({
        url:'/device/getDeviceListByOrgIdAndEnergyTypeCode/'+query.orgId+'/'+query.energyType+'/'+query.pageNo+'/'+query.pageSize,
        method:'post',
        data:query
    })
}

//设备能统计获取数据类型数据
export const getDeviceHisData =(query) =>{
    return request({
        url:'/energy/queryBuildHistoryData',
        method:'post',
        data:query
    })
}

//根据设备类型获取设备数据项
export const getDeviceTypeDataConfig =(query) =>{
    return request({
        url:'/device/getDeviceTypeDataConfigListByDeviceTypeId/'+query.deviceTypeId,
        method:'get',
        data:query
    })
}
//根据设备获取设备数据项
export const getDeviceTypeDataConfigByDeviceId =(query) =>{
    return request({
        url:'/device/getDeviceDataParaListByDeviceId/'+query.deviceId,
        method:'get',
        data:query
    })
}

//获取能源类型数据 新街口
export const getBaseEnergyTypeListNews =(query) =>{
    return request({
        url:'/dic/getBaseEnergyTypeList',
        method:'get',
        data:query
    })
}

//根据能源类型数据获取能耗比例配置接口
export const getEnergyConcretTypeByEnergyBaseTypeId =(query) =>{
    return request({
        url:'/dic/getEnergyConcretTypeByEnergyBaseTypeId/'+query.energyBaseId,
        method:'get',
        data:query
    })
}

//根据设备类型获取数据项数据 新接口

export const getDeviceDataParaByDeviceTypeId =(query) =>{
    return request({
        url:'/device/getDeviceDataParaByDeviceTypeId/'+query.deviceTypeId,
        method:'get',
        data:query
    })
}
//设备管理批量修改
export const BatchUpdateSameTypeDevice =(query) =>{
    return request({
        url:'/device/BatchUpdateSameTypeDevice',
        method:'post',
        data:query
    })
}

//新首页获取数据接口
export const getHomesDataList =(query) =>{
    return request({
        url:'/index/getIndexShowingModule',
        method:'get',
        data:query
    })
}

//保存补录数据
export const  saveInputDataRecord=(query) =>{
    return request({
        url:'/energy/energyRecord',
        method:'post',
        data:query
    })
}

//获取所有补录设备
export const  getReinputDeviceList=(query) =>{
    return request({
        url:'/energy/getManualRecordDeviceList',
        method:'get',
        data:query
    })
}
//手动补传
export const  getManualReportJsonData=(query) =>{
    return request({
        url:'/energy/manualReportJsonData/'+query.dateStr,
        method:'get',
        data:query
    })
}
//设备参数 空气能
export const  queryDeviceRunningData=(query) =>{
    return request({
        url:'/device/running/queryDeviceRunningData',
        method:'post',
        data:query
    })
}
//设备控制参数 空气能
export const  queryDeviceConfigParams=(query) =>{
    return request({
        url:'/device/running/queryDeviceConfigParams',
        method:'post',
        data:query
    })
}
//设备历史数据 空气能
export const  queryDeviceHistoryData=(query) =>{
    return request({
        url:'/device/running/queryDeviceHistoryData',
        method:'post',
        data:query
    })
}
//设备告警信息 空气能
export const  queryDeviceWarningData=(query) =>{
    return request({
        url:'/device/running/queryDeviceWarningData',
        method:'post',
        data:query
    })
}

//设备参数设置 空气能
export const  setDeviceConfigParams=(query) =>{
    return request({
        url:'/device/running/setDeviceConfigParams',
        method:'post',
        data:query
    })
}
//设备控制设置 空气能
export const  manualControll=(query) =>{
    return request({
        url:'/device/manual/controll',
        method:'post',
        data:query
    })
}
//读取设置时钟
export const  readDeviceTime=(query) =>{
    return request({
        url:'/device/running/readDeviceTime',
        method:'post',
        data:query
    })
}
//读取设置时钟
export const  setDeviceTime=(query) =>{
    return request({
        url:'/device/running/setDeviceTime',
        method:'post',
        data:query
    })
}
// 获取设备列表根据用户
export const querAllDevicesByUserId =(query) =>{
    return request({
        url:'/device/querAllDevicesByUserId/' + query.pageNum + '/' + query.pageSize,
        method:'post',
        data:query
    })
}
//获取实时数据
export const  readRealData=(query) =>{
    return request({
        url:'/device/running/readRealData',
        method:'post',
        data:query
    })
}
//获取实时数据的刷新频率等配置
export const  getSysConfigData=(query) =>{
    return request({
        url:'/device/running/getSysConfigData',
        method:'get',
        data:query
    })
}